package com.srq.dao.impl;

import com.srq.dao.RoleDao;
import com.srq.pojo.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class RoleDaoImpl implements RoleDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public List<Role> findAllRole() {
        List<Role> roleList = jdbcTemplate.query("select * from zq.role", new BeanPropertyRowMapper<>(Role.class));
        //System.out.println(roleList);

        return roleList;
    }
}
